﻿"use strict";

$(function () {
    let markFun = $("#mh-markFun");

    let funAdminUser = $("#mh-fun-admin-user");
    let funAdminPet = $("#mh-fun-admin-pet");
    let funAdminEmp = $("#mh-fun-admin-emp");
    let funAdminCommodity = $("#mh-fun-admin-commodity")
    let funAdminShoppingCart = $("#mh-fun-shopping-cart")
    let funAdminOrder = $("#mh-fun-admin-order")

    funAdminUser.removeClass("active");
    funAdminPet.removeClass("active");
    funAdminEmp.removeClass("active");
    funAdminCommodity.removeClass("active");
    funAdminShoppingCart.removeClass("active");
    funAdminOrder.removeClass("active");

    let val = markFun.val();
    switch (val) {
        case "pet":
            funAdminPet.addClass("active")
            break
        case "commodity":
            funAdminCommodity.addClass("active")
            break
        case "emp":
            funAdminEmp.addClass("active")
            break
        case "order":
            funAdminOrder.addClass("active");
            break
        case "user":
        default:
            funAdminUser.addClass("active")
            break
    }

    // $(document).ready(function () {
    //     $('.selectpicker').selectpicker({
    //         noneSelectedText: "请选择"
    //     });
    // })
    // $("#emp1").val()
    // $("#emp1").val("").trigger("change");

    // for (let i = 0; i < document.getElementsByClassName("filter-option-inner-inner").length; i++) {
    //     let roles = document.getElementsByClassName("filter-option-inner-inner")[i];
    //     roles.addEventListener("blur", function () {
    //         document.write("<input name='empRole' value=''>");
    //         let obj = document.getElementsByName("empRole")[0].value(roles.innerText);
    //     })
    // }

    // var title = $(".selectpicker + button").attr("title");
    //
    // alert(title);
    //
    // $(".selectpicker").append($("<input id='box' type='hidden', value='" + title + "'>"));
    //
    // var box = $("#box");
    //
    // var select = $(".selectpicker + button");
    //
    // for (let i = 0; i <= select.length; i++) {
    //     select.eq(i).on("blur", function(){
    //         alert("hello")
    //     })
    // }

    for (let i = 0; i < $(".selectpicker + button").length; i++) {
        $(".selectpicker + button").eq(i).on("click", function () {
            alert($(".selectpicker + button").eq(i).attr("title"))
            $(".selectpicker + button").eq(i).parent().next().val($(".selectpicker + button").eq(i).attr("title"))
        })
    }

    // for (let i = 0; i < $(".selectpicker + div.dropdown-menu").length; i++) {
    //     $(".selectpicker + div.dropdown-menu").eq(i).on("click", function () {
    //         alert($(".selectpicker + button").eq(i).attr("title"))
    //         $(".selectpicker + button").eq(i).parent().next().val($(".selectpicker + button").eq(i).attr("title"))
    //     })
    // }

});

